function [alpha_new, bank_new] = limitdegrate(alphad, bankd, alphad_past, bankd_past)
   global alphaRateLimit bankRateLimit hInt
   if (alphad - alphad_past)/hInt > alphaRateLimit
       alpha_new = alphad_past + alphaRateLimit*hInt;
   elseif (alphad - alphad_past)/hInt < -alphaRateLimit
       alpha_new = alphad_past - alphaRateLimit*hInt;
   else
       alpha_new = alphad;
   end
   delta_bankd = 2 * asin(sin(0.5 * (bankd - bankd_past)));
   if delta_bankd/hInt > bankRateLimit
       bank_new = bankd_past + bankRateLimit*hInt;
   elseif delta_bankd/hInt < -bankRateLimit
       bank_new = bankd_past - bankRateLimit*hInt;
   else
       bank_new = bankd;
   end
end